class NodeTree:
    def __init__(self, val=0, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right


class PreorderTraversal():
    def __init__():
        pass
    def preoder(self, root):
        result = []

        if not root:
            return result

        def traversal(node):
            if not node:
                return
            result.append(node.val)
            traversal(node.left)
            traversal(node.right)
        
        traversal(root)
        return result
    
class InorderTraversal():
    def __init__():
        pass
    def inorder(self, root):
        result = []
        if not root:
            return result
        def traversal(node):
            if not node:
                return
            traversal(node.left)        
            result.append(node.val)
            traversal(node.right)
        traversal(root)
        return result

class PostorderTraversal():
    def __init__():
        pass
    def postorder(self, root):
        result = []
        if not root:
            return result
        def traversal(node):
            if not node:
                return
            traversal(node.left)
            traversal(node.right)
            result.append(node.val)
        traversal(root)
        return result


